
if speedupExample
  miniBatchSize = 12;
else
   miniBatchSize = 128;
end
validationFrequency = floor(numel(TTrain)/miniBatchSize);
options = trainingOptions("adam", ...
    InitialLearnRate=3e-4, ...
    MaxEpochs=15, ...
    MiniBatchSize=miniBatchSize, ...
    Shuffle="every-epoch", ...
    Plots="training-progress", ...
    Verbose=false, ...
    ValidationData=XDataStore(XValidation,TValidation), ...
    ValidationFrequency=validationFrequency);

trainedNet = trainNetwork(XDataStore(XTrain,...
    TTrain),...
    layers,...
    options);
